import { ACTIVITTPATH } from '../../config.js'

Page({
  data: {
    link: '',
    shareToken: '',
    model: '',
    activityId: 0,
    shopId: 0,
    title: '',
    shareImg: ''
  },
  onLoad(options) {
    const { activityName, type, vipFlag} = options
    const userInfoId = wx.getStorageSync('openId');
    const cityId = wx.getStorageSync('cityId');
    const jtxs = wx.getStorageSync('token');
    const role = wx.getStorageSync('type');
    let link = ACTIVITTPATH + '?cityId=' + cityId  + '&jtxs=' + jtxs + '&activityName=' + activityName + '&userInfoId=' + userInfoId + '&type=' + role 
    if(type == '1') {// 秒杀活动
      link = ACTIVITTPATH + 'time_limit' + '?cityId=' + cityId + '&jtxs=' + jtxs + '&vipFlag=' + vipFlag + '&activityName=秒杀活动' + '&userInfoId=' + userInfoId + '&type=' + role
    } else if(type == '2') {// 新人
      link = ACTIVITTPATH + 'new_person' + '?cityId=' + cityId + '&jtxs=' + jtxs + '&vipFlag=' + vipFlag + '&activityName=新人活动' + '&userInfoId=' + userInfoId + '&type=' + role
    } else if(type == '3') {// vip活动
      link = ACTIVITTPATH + 'vip' + '?cityId=' + cityId + '&jtxs=' + jtxs + '&vipFlag=' + vipFlag + '&activityName=vip活动' + '&userInfoId=' + userInfoId + '&type=' + role
    }
    console.log(link);

    this.setData({
      link
    })
  }
})